#include "QutSummary.h"

#include "QutCase.h"

QutSummary::QutSummary(void)
    : event_k(0)
{}

void QutSummary::start(void)
{
    start_ems = QDateTime::currentMSecsSinceEpoch();
}

void QutSummary::add(const QutCase & event)
{
    QutCase::Level level = QutCase::Level(event.getLevel());
    QString fni = event.getFunctionInfo();

    ++event_k;
    if (level > max_level)  max_level = level;
    if ( ! sourceFunctionInfo_list.contains(fni))
        sourceFunctionInfo_list.append(fni);
}

void QutSummary::finish(void)
{
    finish_ems = QDateTime::currentMSecsSinceEpoch();
}

QStringList QutSummary::toStringList(void)
{
    QStringList qsl;
    qsl << QString("%1 : %2").arg("Test Started", -16)
           .arg(QDateTime::fromMSecsSinceEpoch(start_ems).toString());
    qsl << QString("%1 : %2").arg("Tests Performed", -16).arg(event_k);
    return qsl;
}
